package com.zy.orders.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.model.Address;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 用户收货地址 Mapper 接口
 */
@Mapper
public interface AddressMapper extends BaseMapper<Address> {

    /**
     * 将指定用户的所有地址设置为非默认
     *
     * @param userId 用户编号
     */
    @Update("UPDATE address SET isdefault = 0 WHERE userId = #{userId}")
    void clearDefaultStatus(@Param("userId") Long userId);
}

